package org.ruanjj.swappairs;

import org.ruanjj.linkedlist.ListNode;

public class Solution {
    public ListNode swapPairs(ListNode head) {
        if(null == head || null == head.next){
            return head;
        }
        ListNode newHead = head.next;
        head.next = swapPairs(newHead.next);
        newHead.next = head;
        return newHead;
    }
}
